package com.example.springalibabacloudprovicer03.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.springalibabacloudprovicer03.utils.Results;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Classname ProviderController
 * @Description TODO
 * @Date 2022/5/13 22:09
 * @Created by XiongXiong
 * @Author: X.I.O
 */
@RestController
@RequestMapping("pro")
@Api(tags = "api服务提供者3")
public class ProviderController {

    /**
     * 登录
     * 127.0.0.1:8006/oauth/token?username=user_1&password=123456&grant_type=password&scope=all&client_id=wuzzClientId&client_secret=wuzzSecret
     *
     * 获取用户凭证
     * http://localhost:8006/users/current
     *
     * headers key Authorization
     *
     * headers value Bearer 25aa7a5b-286a-4799-87ea-da62579eb95b
     *
     *
     * 127.0.0.1:8011/pro/api
     * headers key Authorization
     * headers value Bearer 25aa7a5b-286a-4799-87ea-da62579eb95b
     *
     *  通过网关访问:
     *  需要配置服务路由规则
     *  127.0.0.1:8004/provider/pro/api
     *
     *
     * @return
     */

    @GetMapping("/api")
    @ApiOperation("服务提供者3")
    public JSONObject apiController(){
        return Results.success("我是服务提供者3");
    }


    @GetMapping("/v2")
    public JSONObject v2Controller(){
        return Results.success("我是服务提供者v2_1");
    }

    @PostMapping("v3")
    public JSONObject v3Controller(){
        return Results.success("我是五福提供者v3_1");
    }
}
